package cn.yuhe.basic.config;


import cn.yuhe.basic.controller.LoginController;
import cn.yuhe.basic.interceptor.Loginlnterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.transform.impl.AddInitTransformer;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration // 当前类是一个配置类
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private Loginlnterceptor loginlnterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginlnterceptor) // 指定我们自己的登录拦截器
                .addPathPatterns("/**") // 设置拦截所有
                .excludePathPatterns("/login/**") // 设置登录放行路径
                .excludePathPatterns("/fastDfs/**") // 设置登录放行路径
                .excludePathPatterns("/verifyCode/**") // 放行发送验证码相关
                .excludePathPatterns("/shop/settlement") // 放行店铺入住
                .excludePathPatterns("/user/register/**"); // 放行电话注册
    }
}
